]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
overviewControls: Bind state adjustment signals to parent lifetime
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Fri, 31 Oct 2025 03:57:50 +0000 (04:57 +0100)
committerMarge Bot <marge-bot@gnome.org>
Mon, 3 Nov 2025 12:14:29 +0000 (12:14 +0000)
On tests shutdown we were sometimes getting this error:

  ** Message: 09:29:27.494: Shutting down GNOME Shell

  (gnome-shell:3728700): Gjs-CRITICAL **: 09:29:27.545:
  JS ERROR: TypeError: this._workspacesDisplay is undefined
  _update@resource:///org/gnome/shell/ui/overviewControls.js:599:37
  _initializeUI/<@resource:///org/gnome/shell/ui/main.js:279:14

Which after using the arrow function becomes:

  (gnome-shell:3731979): Gjs-CRITICAL **: 09:30:05.419:
  JS ERROR: TypeError: this._workspacesDisplay is undefined
  _update@resource:///org/gnome/shell/ui/overviewControls.js:599:37
  _init/<@resource:///org/gnome/shell/ui/overviewControls.js:343:67
  _initializeUI/<@resource:///org/gnome/shell/ui/main.js:279:14

This is because the state adjustement object lifetime is not bound to
the ControlsManager, and so we were potentially accessing to invalid
data

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3943>

js/ui/overviewControls.js

index b8f78992549c0654207c1965e92bca9e30eab1c8..5d6708ee6c8c91f9430afae08983ae5f671e21bf 100644 (file)
@@ -340,7 +340,8 @@ class ControlsManager extends St.Widget {
         this._workspaceAdjustment = Main.createWorkspacesAdjustment(this);
 
         this._stateAdjustment = new OverviewAdjustment(this);
-        this._stateAdjustment.connect('notify::value', this._update.bind(this));
+        this._stateAdjustment.connectObject('notify::value',
+            () => this._update(), this);
 
         this._searchController = new SearchController.SearchController(
             this._searchEntry,